package com.hooya.fa.eu.biz.dao.repository.impl;

import com.hooya.fa.eu.biz.dao.entity.TempZyjlChange;
import com.hooya.fa.eu.biz.dao.entity.TempZyjlDelete;
import com.hooya.fa.eu.biz.dao.mapper.stk.TempZyjlChangeMapper;
import com.hooya.fa.eu.biz.dao.mapper.stk.TempZyjlDeleteMapper;
import com.hooya.fa.eu.biz.dao.repository.TempZyjlRelationRepository;
import com.hooya.fa.eu.biz.dao.wrapper.TempZyjlChangeWrapper;
import com.hooya.fa.eu.biz.dao.wrapper.TempZyjlDeleteWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description 转运相关操作库
 * @Author : Zongz
 * @Copyright Copyright (c) 豪雅集团
 * @Create 2024/10/21
 * @Version 1.1.0
 */
@Slf4j
@Repository
@RequiredArgsConstructor
public class TempZyjlRelationRepositoryImpl implements TempZyjlRelationRepository {

    private final TempZyjlChangeMapper tempZyjlChangeMapper;

    private final TempZyjlDeleteMapper tempZyjlDeleteMapper;

    @Override
    public List<TempZyjlDelete> getDeleteListByCondition(String place, String date, List<String> skuList) {
        List<TempZyjlDelete> res = tempZyjlDeleteMapper.selectList(
                TempZyjlDeleteWrapper.newQuery().eqZcck(place).geDate(date).inSku(skuList));
        return CollectionUtils.isEmpty(res) ? new ArrayList<>() : res;
    }

    @Override
    public List<TempZyjlChange> getChangeListByCondition(String place, String date, List<String> skuList) {
        List<TempZyjlChange> res = tempZyjlChangeMapper.selectList(
                TempZyjlChangeWrapper.newQuery().eqZcck(place).geDate(date).inSku(skuList));
        return CollectionUtils.isEmpty(res) ? new ArrayList<>() : res;
    }
}
